import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import hasRight from "./directives/hasRigth";
import enUS from "./locale/enUS";
import zhCN from "./locale/zhCN";
// 业务文案中的国际化方案
import VueI18n from "vue-i18n";
// 导入高亮js
import VueHighlightJS from "vue-highlightjs";

// 按需加载vue组件
import {
  Button,
  Icon,
  Input,
  Layout,
  Breadcrumb,
  Menu,
  Drawer,
  Radio,
  Form,
  Select,
  LocaleProvider,
  DatePicker,
  Dropdown
} from "ant-design-vue";
// import "ant-design-vue/dist/antd.less"; // or 'ant-design-vue/dist/antd.less'
Vue.use(Button);
Vue.use(Icon);
Vue.use(Input);
Vue.use(Layout);
Vue.use(Breadcrumb);
Vue.use(Menu);
Vue.use(Drawer);
Vue.use(Radio);
Vue.use(Form);
Vue.use(Select);
Vue.use(LocaleProvider);
Vue.use(DatePicker);
Vue.use(Dropdown);
// 使用插件式来注册一个全局指令
Vue.use(hasRight);
Vue.use(VueI18n);
Vue.use(VueHighlightJS);

// 初始化配置i18n语言环境
const i18n = new VueI18n({
  locale: "zhCN",
  messages: {
    zhCN: { message: zhCN },
    enUS: { message: enUS }
  }
});

// 引入iconfont
const IconFont = Icon.createFromIconfontCN({
  scriptUrl: "//at.alicdn.com/t/font_1628425_clhdzsxvz4a.js" // 在 iconfont.cn 上生成
});
// 注册全局组件
Vue.component("IconFont", IconFont);
Vue.config.productionTip = false;

new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount("#app");
